<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, shrink-to-fit=no, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>搜索结果</title>

    <!-- Bootstrap Core CSS -->
    <link href="<%=request.getContextPath()%>/css/common_css/bootstrap_css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="<%=request.getContextPath()%>/css/common_css/sidebar_css/sidebar.css" rel="stylesheet">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script type="text/javascript">
        function getInfo(str) {
            var cont=document.getElementById("txt").value
            var link=document.getElementById("test")
            link.setAttribute("href","searchInfo!searchCourse.action?stuid="+str+"&keyword="+cont)
            link.click()
        }
        function  check(courseid,stuid) {
            var isconfirm=confirm("确定退课吗?")
            if(isconfirm==true){
                var testhref=document.getElementById("test")
                testhref.setAttribute("href","delSelectionCourse!delSel.action?stuid="+stuid+"&courseid="+courseid)
                testhref.click()
            }else{

            }
        }
    </script>
</head>

<body>

<div id="wrapper">

    <!-- Sidebar -->
    <div id="sidebar-wrapper">
        <ul class="sidebar-nav">

            <!-- 标题 -->
            <li class="sidebar-brand">
                <a href="#">
                    教务管理系统
                </a>
            </li>

            <!-- 排课子系统 -->
            <li>
            </li>

            <!-- 毕设管理子系统 -->
            <li>
            </li>

            <!-- 后台管理子系统 -->
            <li>
            </li>

            <!-- 成绩查询子系统 -->
            <li>
            </li>

            <!-- 选课子系统 -->
            <li>
                <a href="javascript:;" data-toggle="collapse" data-target="#selection">选课</a>
                <ul id = "selection" class="collapse">
                    <li>
                        <a href="<%=request.getContextPath()%>/htmls/selection/student.jsp">我的课程</a>
                    </li>
                </ul>
            </li>

            <!-- 注销 -->
            <li>
                <a href="<%=request.getContextPath()%>/login.jsp">注销</a>
            </li>

            <li>
                <a href="#">关于本站</a>
            </li>
        </ul>
    </div>
    <!-- /#sidebar-wrapper -->

    <!-- Page Content -->
    <div id="page-content-wrapper">
        <div class="container-fluid">
            <div class="row">
                <div class="col-lg-12">

                    <!--全部课程（包括已选和可选但未选的课程）-->
                    <div class="row clearfix">
                        <div class="col-lg-12 column">
                            <div class="table-responsive">
                                <table class="table table-bordered table-condensed table-hover">
                                    <thead>
                                    <tr>
                                        <th>课程代码</th>
                                        <th>课程名称</th>
                                        <th>学分</th>
                                        <th>授课教师</th>
                                        <th>课程性质</th>
                                        <th>选课情况</th>
                                        <th>退选</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <s:iterator value="searchresult" id="li" var="test">
                                    <tr>
                                        <td><s:property value="courseid"></s:property> </td>
                                        <td id="">
                                            <button class="btn btn-link"><a href="ShowDetailAction!showDetailCourse.action?courseid=${test.courseid}"><s:property value="coursename"></s:property> </a></button>
                                        </td>
                                        <td><s:property value="credit"></s:property> </td>
                                        <td><s:property value="tname" ></s:property></td>
                                        <td><s:property value="coursetype"></s:property> </td>
                                        <td><s:property value="exitselect"></s:property> </td>
                                        <s:if test="coursetype=='必修'"><td>必修课不能退</td></s:if>
                                        <s:if test="coursetype=='辅修'">
                                            <td><button  class="btn btn-link" onclick="check('${courseid}','${stuid}')">退课 </button></td>
                                        </s:if>
                                        <s:if test="coursetype=='选修'">
                                            <td><button  class="btn btn-link" onclick="check('${courseid}','${stuid}')">退课 </button></td>
                                        </s:if>
                                        </s:iterator>
                                    </tr>
                                    <tr>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    <!---->
                    <!--底部导航-->
                        </div>
                    </div>
                    <!---->
                </div>
            </div>
        </div>
    </div>
    <!-- /#page-content-wrapper -->
</div>
<!-- /#wrapper -->

<!-- jQuery -->
<script src="<%=request.getContextPath()%>/js/common_js/jquery/jquery.min.js"></script>

<!-- Bootstrap Core JavaScript -->
<script src="<%=request.getContextPath()%>/js/common_js/bootstrap_js/bootstrap.min.js"></script>

<!--这是按表格中关键字搜索的代码，我不确定有没有用-->
<script>
    $(function(event){
        $("#sch").click(function(){
            var stxt=$("#txt").val();
            if($.trim(stxt)!=""){
                $("table tbody tr").hide().filter(":contains('"+stxt+"')").show();
            }else{
                $("table tbody tr").show();
            }
        });
        //event.preventDefault();
    })
</script>

<!-- Menu Toggle Script -->
<script>
    $("#menu-toggle").click(function(e) {
        e.preventDefault();
        $("#wrapper").toggleClass("toggled");
    });
</script>
</body>

</html>
